<!DOCTYPE html>
<head>
    <title>SRI with options</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
    var tests = [
        "sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=?foo=bar",
        "sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=?foo=bar?baz=foz",
        "sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=?",
        "sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=?foobar",
        "sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=?foo=bar?",
        "sha256-B0/62fJSJFrdjEFR9ba04m/D+LHQ+zG6PGcaR0Trpxg=?foo&bar?",
    ];

    var success;

    function addTest() {
        var next_test = tests.shift();
        if (next_test)
            async_test(makeTest(next_test));
    }

    function makeTest(integrity) {
        return function() {
            var script = document.createElement('script');
            success = this.step_func(function() {
                addTest();
                this.done();
            });
            var scriptError = this.step_func(function() {
                assert_unreached();
                addTest();
                this.done();
            });
            script.src = 'call-success.js';
            script.onerror = scriptError;
            script.integrity = integrity; 
            document.body.appendChild(script);
        };
    }

    async_test(makeTest(tests.shift()));
</script>
</body>
